package cn.bobmao.exts.example.controller.user;

import cn.bobmao.exts.example.model.user.AccountModel;
import cn.bobmao.exts.example.service.user.AccountService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/accounts")
public class AccountController {

    private final AccountService service;

    public AccountController(AccountService service) {
        this.service = service;
    }

    @GetMapping
    List<AccountModel> findAll() {
        return service.findAll();
    }

    @GetMapping("{id}")
    AccountModel find(@PathVariable String id) {
        return service.find(id);
    }

}
